#ifndef GET_UAV_LOCATION_HPP
#define GET_UAV_LOCATION_HPP

#include "mavlink/common/mavlink.h"
#include <QObject>
#include <QSerialPort>

class GetUavLocation : public QObject {
  Q_OBJECT
public:
  GetUavLocation(QObject *parent = nullptr, QSerialPort *serialPort = nullptr, mavlink_message_t mavlink_msg = {});
  ~GetUavLocation() = default;

signals:
  // 添加位置更新信号
  void positionUpdated(double lat, double lng, double altitude, double heading, int droneId);

public slots:
  // 更新mavlink消息并发射信号
  void updateMavlinkMessage(const mavlink_message_t& msg);

private:
  QSerialPort *serialPort;
  mavlink_message_t mavlink_msg;
};

#endif